var timer = null;


window.onload = function() {
	var div1 = document.getElementById("div1");
	div1.onmouseover = function() {
		Move(0);
	}
	/*div1.onmouseout = function() {
		Move(-200);
	}*/
}

function Move(iTarget) {
	var speed;
	var div1 = document.getElementById("div1");
	clearInterval(timer);
	timer = setInterval(function() {
		if (div1.offsetLeft < iTarget) { //to right
			speed = (iTarget-div1.offsetLeft)/20;//速度变化
			speed=speed>0?Math.ceil(speed):Math.floor(speed);//速度为正，向上取整
			div1.style.left = div1.offsetLeft + speed + "px";
		}
		/*if (div1.offsetLeft > iTarget) { //to left
			speed = -10;
			div1.style.left = div1.offsetLeft + speed + "px";
		}*/

	}, 20);
}